/**
 * 
 */
package sqs.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kjleng
 *
 */
public class SingleAnsMCQQuestion extends MCQQuestion {
	private List<SingleAnsMCQQuestionAnswer> singleAnsMCQQuestionAnswers = new ArrayList<SingleAnsMCQQuestionAnswer>();
	private List<Option> options = new ArrayList<Option>();
        private String reportOrder = MCQQuestion.SORTBY_ORDERNO;
       
	public void addAnswer(Answer ans){
		singleAnsMCQQuestionAnswers.add((SingleAnsMCQQuestionAnswer)ans);
		answered = true;
	}
	
	public List<SingleAnsMCQQuestionAnswer> getSingleAnsMCQQuestionAnswers() {
		return singleAnsMCQQuestionAnswers;
	}

	public void setSingleAnsMCQQuestionAnswers(
			List<SingleAnsMCQQuestionAnswer> singleAnsMCQQuestionAnswers) {
		this.singleAnsMCQQuestionAnswers = singleAnsMCQQuestionAnswers;
	}
        
	public Answer createAnswer(){
		return new SingleAnsMCQQuestionAnswer();
	}
	
	public void setOptions(List<Option> options) {
		this.options = options;
	}

	public List<Option> getOptions(){
		return options;
	}
	
	public int getNumOfRespondents(){
		return singleAnsMCQQuestionAnswers.size();
	}
	
	public List getAnswers(){
		return singleAnsMCQQuestionAnswers;
	}

        // Added by Joko 18/01/2008
        public String getReportOrder() {
                return reportOrder;
        }
        
        // Added by Joko 18/01/2008
        public void setReportOrder(String reportOrder) {
                this.reportOrder = reportOrder;
        }

        // Added by Joko 18/01/2008
        public Option getOptionById(int optionId) {
                for(Option o : options) {
                        if(o.getOptionId()==optionId)
                                return o;
                }
                return null;
        }        
}

